/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/


#ifndef MK_SIP_UDP_LISTENER_H
#define MK_SIP_UDP_LISTENER_H
#include "MkSipListener.h"
#include "MkSocket/MkSocket.h"
#include "MkSipUtil.h"
class MkApi CMkSipUdpListener : public CMkSipListener, public CMkSocket
{
public:
    CMkSipUdpListener(CMkEvent* pEvent, CMkTimer* pTimer, CMkSipServer* pParent);
    ~CMkSipUdpListener();
    Uint32 Start(const MkString& ListenHost, Uint16 ListenPort, const MkString& PublicHost, Uint16 PublicPort) override;
    Uint32 SendSipMessage(const CMkSipMessage& SipMessage, const SipMsgCompleteCallback& Cb = nullptr, BOOL bResend = FALSE) override;
protected:
    Uint32 OnRecvFrom() override;
private:
    Uint32                  m_MaxRecvLen;
    Uint8*                  m_pRecvBuffer;
};


#endif